/*
 * Ext GWT 2.2.5 - Ext for GWT
 * Copyright(c) 2007-2010, Ext JS, LLC.
 * licensing@extjs.com
 * 
 * http://extjs.com/license
 */
package com.rattsoftware.client.model;

import com.extjs.gxt.ui.client.data.BaseModelData;
import com.rattsoftware.server.admin.model.Staff;

public class StaffSummary extends BaseModelData {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1625161079589738178L;
	private Staff staff;

	public StaffSummary() {	}

	public StaffSummary(Staff staff) {
		setStaff(staff);
		setId(staff.getId());
		setTitle(staff.getTitle());
		setFirstName(staff.getFirstName());
		setLastName(staff.getLastName());
		setGender(staff.getGender());
		//setEmploymentType(staff.getEmploymentType());
		setStaffType(staff.getType());
		//setPhoneNumber(staff.getPhoneNumber());
		//setResidentialAddress(staff.getResidentialAddress());
		setDepartment(staff.getDepartment().getName());
		setEmailAddress(staff.getEmail());
		setDateOfBirth(staff.getDob());
		setName(staff.getFirstName(), staff.getLastName());
	}
	
	public void setId(String id) {
		staff.setId(id);
		set("staffId", id);
	}

	public String getId() {
		return get("staffId");
	}
	
	public String getName() {
		return get("name");
	}

	public void setName(String firstName, String lastName) {
		set("name", firstName + " " + lastName);
	}

	
	public String getFirstName() {
		return get("firstName");
	}

	public void setFirstName(String firstName) {
		staff.setFirstName(firstName);
		set("firstName", firstName);
	}

	public String getLastName() {
		return get("lastName");
	}

	public void setLastName(String lastName) {
		staff.setLastName(lastName);
		set("lastName", lastName);
	}

	public String getGender() {
		return get("gender");
	}

	public void setGender(String gender) {
		staff.setGender(gender);
		set("gender", gender);
	}

	public String getEmploymentType() {
		return get("employmentType");
	}

	public void setEmploymentType(String employmentType) {
		//staff.setEmploymentType(employmentType);
		set("employmentType", employmentType);
	}

	public String getStaffType() {
		return get("staffType");
	}

	public void setStaffType(String staffType) {
		staff.setType(staffType);
		set("staffType", staffType);
	}

	public String getEmailAddress() {
		return get("emailAddress");
	}

	public void setEmailAddress(String emailAddress) {
		staff.setEmail(emailAddress);
		set("emailAddress", emailAddress);
	}

	public String getResidentialAddress() {
		return get("residentialAddress");
	}

	public void setResidentialAddress(String residentialAddress) {
		//staff.setResidentialAddress(residentialAddress);
		set("residentialAddress", residentialAddress);
	}
	
	public String getPhoneNumber() {
		return get("phoneNumber");
	}

	public void setPhoneNumber(String phoneNumber) {
		//staff.setPhoneNumber(phoneNumber);
		set("phoneNumber", phoneNumber);
	}
	
	public String getTitle() {
		return get("title");
	}

	public void setTitle(String title) {
		staff.setTitle(title);
		set("title", title);
	}
	
	public String getDepartment() {
		return get("department");
	}

	public void setDepartment(String department) {
		set("department", department);
	}
	
	public String getDateOfBirth() {
		return get("dateOfBirth");
	}

	public void setDateOfBirth(String dateOfBirth) {
		staff.setDob(dateOfBirth);
		set("dateOfBirth", dateOfBirth);
	}

	public void setStaff(Staff staff) {
		this.staff = staff;
	}

	public Staff getStaff() {
		return staff;
	}
	
	public void updateStaffSummary(Staff staff) {
		setId(staff.getId());
		setTitle(staff.getTitle());
		setFirstName(staff.getFirstName());
		setLastName(staff.getLastName());
		setGender(staff.getGender());
		//setEmploymentType(staff.getEmploymentType());
		setStaffType(staff.getType());
		//setPhoneNumber(staff.getPhoneNumber());
		//setResidentialAddress(staff.getResidentialAddress());
		setDepartment(staff.getDepartment().getName());
		setEmailAddress(staff.getEmail());
		setDateOfBirth(staff.getDob());
		setName(staff.getFirstName(), staff.getLastName());
	}
}
